# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-safedexml
pkgname=('python2-safedexml' 'python-safedexml')
_pkgname=safedexml
pkgver=0.5.1
pkgrel=9
pkgdesc='A defusedxml version of dead-simple Object-XML mapper for Python.'
arch=('any')
url='https://pypi.org/project/safedexml/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('3e9ebef0044d3319aae98a71cdb9790639c8eaadd9bd0775aa95c4bf56daaa1bd79614ee1600a347f757365ef447ce973e0b4e596a3d500b9c148a94efb0ee0a')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-safedexml() {
  depends=('python2' 'python2-defusedxml')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-safedexml() {
  depends=('python' 'python-defusedxml')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

